<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
  <title>Title</title>
  <base href="${basePath}">
  <link rel="stylesheet" href="static/plugins/layui/css/layui.css">
  <script src="static/plugins/jquery-3.1.0.js"></script>
  <script src="static/plugins/layui/layui.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo layui-hide-xs layui-bg-black">用车申请后台</div>
    <!-- 头部区域（可配合layui 已有的水平导航） -->
    <ul class="layui-nav layui-layout-right" style="margin-right: 10px;">
      <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
        <a href="javascript:;">
          ${loginInfo.nickname}
        </a>
        <dl class="layui-nav-child">
          <dd><a href="javascript:;" id="info">个人信息</a></dd>
          <dd><a href="javascript:;" id="password">修改密码</a></dd>
          <dd><a href="javascript:;" id="logout">退出系统</a></dd>
        </dl>
      </li>
    </ul>
  </div>
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree" lay-filter="test">
        <!-- 申请用车菜单项保持原样，不做权限控制 -->
        <c:if test="${loginInfo.role == 2 || loginInfo.role == 3}">

        <li class="layui-nav-item layui-nav-itemed">
          <a href="userinfo" target="manager">申请用车</a>
        </li>
        </c:if>
        <!-- 管理员权限控制的菜单 -->
        <c:if test="${loginInfo.role == 1 || loginInfo.role == 2}">
          <li class="layui-nav-item layui-nav-itemed">
            <a class="" href="javascript:;">用户管理</a>
            <dl class="layui-nav-child">
              <dd><a href="userinfo" target="manager">用户列表</a></dd>
              <c:if test="${loginInfo.role == 1}">
                <dd><a href="role" target="manager">部门列表</a></dd>
              </c:if>
            </dl>
          </li>
        </c:if>
        <c:if test="${loginInfo.role == 1 || loginInfo.role == 4}">
          <li class="layui-nav-item layui-nav-itemed">
            <a class="" href="javascript:;">车辆管理</a>
            <dl class="layui-nav-child">
              <dd><a href="category" target="manager">类型列表</a></dd>
              <dd><a href="car" target="manager">汽车列表</a></dd>
            </dl>
          </li>
        </c:if>
        <li class="layui-nav-item layui-nav-itemed">
          <a class="" href="javascript:;">记录管理</a>
          <dl class="layui-nav-child">
            <c:if test="${loginInfo.role == 2 || loginInfo.role == 3}">
              <dd><a href="try" target="manager">申请列表</a></dd>
            </c:if>
            <c:if test="${loginInfo.role == 2 || loginInfo.role == 1}">
            </c:if>
            <dd><a href="cinema" target="manager">审核列表</a></dd>
            <dd><a href="cinema" target="manager">还车列表</a></dd>
            <dd><a href="cinemaTime" target="manager">全部数据</a></dd>
          </dl>
        </li>
      </ul>
    </div>
  </div>
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
      <iframe name="manager" width="100%" height="100%" allowfullscreen src="page?param=welcome" frameborder="none"></iframe>
    </div>
  </div>
</div>
</body>
<script>
  $(function () {
    $("#password").click(function () {
      layer.open({
        type:2,
        title:"修改密码",
        area:["400px","450px"],
        content:"userinfo?param=pwd"
      })
    })
    $("#logout").click(function () {
      layer.confirm("确认退出系统吗？",{icon:3,title: "退出系统"},function (index) {
        top.location.replace("userinfo?param=logout")
        layer.close(index);
      });
    });
    $("#info").click(function (){
      sessionStorage.setItem("dataId","${loginInfo.id}");
      layer.open({
        type:2,
        title:"用户详情",
        area:["450px","400px"],
        content:"userinfo?param=edit"
      })
    })
  })

</script>
</html>
